<span class="<?php echo $class ?>">
  <label for="<?php echo $name ?>"><?php echo $title ?></label>

  <span class="form-element-body">
    <input id="file_upload" name="file_upload" type="file"/>
    <input type="button" id="upload" value="Upload"/>
  </span>
</span>

<?php $config = Simplify::config() ?>
<?php echo $this->html->css($config['theme_url'] . '/uploadify/uploadify.css') ?>
<?php echo $this->javascript->link('swfobject.js') ?>
<?php echo $this->javascript->link($config['theme_url'] . '/uploadify/jquery.uploadify.v2.1.4.min.js') ?>

<script>
$(document).ready(function() {
  $('#file_upload').uploadify({
    uploader: '<?php echo $config['theme_url'] ?>/uploadify/uploadify.swf',

    script: '<?php echo Simplify::response()->makeUrl(Simplify::request()->route() . '.json') ?>',
    scriptData: { action: 'index', mode: 'upload', sid: '<?php echo session_id() ?>' },
    method: 'GET',

    //checkScript: '<?php echo Simplify::response()->makeUrl(Simplify::request()->route() . '.json', array('action' => 'index', 'mode' => 'upload_check', 'sid' => session_id())) ?>',
    cancelImg: '<?php echo $config['theme_url'] ?>/uploadify/cancel.png',
    multi: true,
    removeCompleted: true,
    auto: true,
    onError: function(event, ID, fileObj, errorObj) {
      alert(errorObj.info);
    },
    onComplete: function(event, ID, fileObj, response, data) {
      alert(response);
    }
  });

  $('#upload').click(function() {
    $('#file_upload').uploadifyUpload();
  });
});
</script>